﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Autenticazione
{
    public partial class Coach : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["EMail"] == null)
                Response.Redirect("Autenticazione.aspx");
        }

        protected void btnSalvaCoach_Click(object sender, EventArgs e)
        {
            //string strScript = @"<script language='JavaScript'>NavigateBack()</script>";
            BusinessObject.Coach coach = new BusinessObject.Coach();

            if (Session["EMail"] == null)
                Response.Redirect("Autenticazione.aspx");

            coach.EMail = Session["EMail"].ToString();
            coach.FullName = this.txtFullName.Text.Replace("'", "''");
            coach.Phone = this.txtTelefono.Text;

            if (Page.IsValid)
            {
                coach.Salva();
                this.ClientScript.RegisterClientScriptBlock(this.GetType(), "Close", "window.close(); window.opener.Aggiorna()", true);
            }
        }
    }
}